home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 1XZWIX6 (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  2.2 KB  |  75 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Dimension;
  6. import java.awt.Frame;
  7. import java.awt.Graphics;
  8. import java.awt.Insets;
  9. import java.awt.Point;
  10. import java.awt.Window;
  11.  
  12. class BasicToolBarUI$DragWindow extends Window {
  13.    Color borderColor;
  14.    int orientation;
  15.    Point offset;
  16.  
  17.    BasicToolBarUI$DragWindow(Frame f) {
  18.       super(f);
  19.       this.borderColor = Color.gray;
  20.       this.orientation = 0;
  21.    }
  22.  
  23.    public void setOrientation(int o) {
  24.       if (((Window)this).isShowing()) {
  25.          if (o == this.orientation) {
  26.             return;
  27.          }
  28.  
  29.          this.orientation = o;
  30.          Dimension size = ((Component)this).getSize();
  31.          ((Component)this).setSize(new Dimension(size.height, size.width));
  32.          if (this.offset != null) {
  33.             this.setOffset(new Point(this.offset.y, this.offset.x));
  34.          }
  35.  
  36.          ((Component)this).repaint();
  37.       }
  38.  
  39.    }
  40.  
  41.    public Point getOffset() {
  42.       return this.offset;
  43.    }
  44.  
  45.    public void setOffset(Point p) {
  46.       this.offset = p;
  47.    }
  48.  
  49.    public void setBorderColor(Color c) {
  50.       if (this.borderColor != c) {
  51.          this.borderColor = c;
  52.          ((Component)this).repaint();
  53.       }
  54.    }
  55.  
  56.    public Color getBorderColor() {
  57.       return this.borderColor;
  58.    }
  59.  
  60.    public void paint(Graphics g) {
  61.       Color temp = g.getColor();
  62.       g.setColor(((Component)this).getBackground());
  63.       Dimension size = ((Component)this).getSize();
  64.       g.fillRect(0, 0, size.width, size.height);
  65.       g.setColor(this.getBorderColor());
  66.       g.drawRect(0, 0, size.width - 1, size.height - 1);
  67.       g.setColor(temp);
  68.       super.paint(g);
  69.    }
  70.  
  71.    public Insets getInsets() {
  72.       return new Insets(1, 1, 1, 1);
  73.    }
  74. }
  75.